class LoadboxesController < ApplicationController
  # GET /loadboxes
  # GET /loadboxes.json
  def index
    @loadboxes = Loadbox.all

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @loadboxes }
    end
  end

  # GET /loadboxes/1
  # GET /loadboxes/1.json
  def show
    @loadbox = Loadbox.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @loadbox }
    end
  end

  # GET /loadboxes/new
  # GET /loadboxes/new.json
  def new
    @loadbox = Loadbox.new

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @loadbox }
    end
  end

  # GET /loadboxes/1/edit
  def edit
    @loadbox = Loadbox.find(params[:id])
  end

  # POST /loadboxes
  # POST /loadboxes.json
  def create
    @loadbox = Loadbox.new(params[:loadbox])

    respond_to do |format|
      if @loadbox.save
        format.html { redirect_to @loadbox, notice: 'Loadbox was successfully created.' }
        format.json { render json: @loadbox, status: :created, location: @loadbox }
      else
        format.html { render action: "new" }
        format.json { render json: @loadbox.errors, status: :unprocessable_entity }
      end
    end
  end

  # PUT /loadboxes/1
  # PUT /loadboxes/1.json
  def update
    @loadbox = Loadbox.find(params[:id])

    respond_to do |format|
      if @loadbox.update_attributes(params[:loadbox])
        format.html { redirect_to @loadbox, notice: 'Loadbox was successfully updated.' }
        format.json { head :ok }
      else
        format.html { render action: "edit" }
        format.json { render json: @loadbox.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /loadboxes/1
  # DELETE /loadboxes/1.json
  def destroy
    @loadbox = Loadbox.find(params[:id])
    @loadbox.destroy

    respond_to do |format|
      format.html { redirect_to loadboxes_url }
      format.json { head :ok }
    end
  end
end
